home *** CD-ROM | disk | FTP | other *** search
/ Exploring Where & Why / Exploring Where & Why.iso / pc / Lib.cst / 00021_Application.ls < prev    next >
Encoding:
Text File  |  2004-07-11  |  4.6 KB  |  184 lines

  1. --
  2. -- Application
  3. --
  4.  
  5. -- constants:
  6.  
  7.  
  8. property ancestor
  9. property stepNum
  10.  
  11. global gPrinterB,gBannerartB,gLeftB,gSpeakerB,gHomeB,gHelpB,gRightB
  12.  
  13. on new me
  14.   set ancestor = new (script "NavStructSetUp")
  15.   initSoundList ()
  16.   setup (me)
  17.   set stepNum = 1
  18.   -- add (the actorList, new (script "ObjectUpdater", me))
  19.   return me
  20. end
  21.  
  22.  
  23. on destruct me
  24.   if objectP (ancestor) then destruct (ancestor)
  25.   set ancestor = 0
  26. end
  27.  
  28.  
  29. -- mouseDown on a specific navigation button.
  30.  
  31. on mousedown me, spr
  32.   set mem = the memberNum of sprite spr 
  33.   set cLib = the castLibNum of sprite spr
  34.   if mem then set name = item 1 of the name of member mem of castLib cLib
  35.   else set name = 0
  36.   
  37.   case (name) of
  38.     "printer": -- sprite 41:
  39.       if basicNameAnim (me, name, spr, 6) then printActivitySpace (me)
  40.     "bannerart","topbanner","speaker":  --42,43,44: 
  41.       playBanner (me) -- replay the banner
  42.     "left":  --45:
  43.       if not basicNameAnim (me, name, spr, 6) then return 1
  44.       
  45.       if the frame < label("finish") then
  46.         --open the dialog window
  47.         openDialogWin(me, "activityPrev")
  48.       end if
  49.     "help":  --46:  
  50.       if not basicNameAnim (me, name, spr, 6) then return 1
  51.       
  52.       --      global gType
  53.       --      
  54.       --      case (gType) of 
  55.       --        #DirectionArrows: 
  56.       --          set theFile = "HELPDA"
  57.       --        #ClickIdentify:
  58.       --          set theFile = "HELPCI"
  59.       --        #DragDropStick:
  60.       --          set theFile = "HELPDD"
  61.       --        #DragDropHide:
  62.       --          set theFile = "HELPDD"
  63.       --        #DragDropColor:
  64.       --          set theFile = "HELPDD"
  65.       --        #SinglePoint:
  66.       --          set theFIle = "HELPDD"
  67.       --        #SinglePointStick:
  68.       --          set theFile = "HELPDD"
  69.       --        #SinglePointStickB:
  70.       --          set theFile = "HELPDD"
  71.       --        #SinglePointColor:
  72.       --          set theFile = "HELPDD"
  73.       --        #MatchGame:
  74.       --          set theFile = "HELPMG"
  75.       --        #StdPaint:
  76.       --          set theFile = "HELPPNT"
  77.       --        otherwise
  78.       --          set theFile = "HELPMM"
  79.       --      end case
  80.       --      
  81.       --      initHelpWin (me, 0, theFile)
  82.     "home":  -- 47:
  83.       if not basicNameAnim (me, name, spr, 6) then return 1
  84.       
  85.       if the movieName contains "main" then
  86.         openDialogWin (me, "quit")
  87.       else if isLastActivity (me) and the frame >= label("finish")  then 
  88.         goMain (me)
  89.       else
  90.         openDialogWin (me, "lesson")
  91.         -- goMain (me)  -- main menu
  92.       end if
  93.     "bye":
  94.       if not basicNameAnim (me, name, spr, 6) then return 1
  95.       
  96.       if the movieName contains "main" then
  97.         openDialogWin (me, "quit")
  98.       end if
  99.       
  100.     "right":  --48: 
  101.       if not basicNameAnim (me, name, spr, 6) then return 1
  102.       
  103.       if the frame < label("finish") then
  104.         --open the dialog window
  105.         openDialogWin(me, "activityNext")
  106.       else
  107.         next (me)  -- next activity
  108.       end if
  109.       
  110.     otherwise return 0
  111.   end case
  112.   return 1
  113. end
  114.  
  115.  
  116. on quit me
  117.   spritesOff
  118.   killActorList (me)
  119.   go to Frame "quit"
  120. end
  121.  
  122.  
  123.  
  124. on stepFrame me
  125.   stepFrame (ancestor)
  126.   --if stepNum mod 20 = 0 then 
  127.   checkGUICursors (me)
  128.   --set stepNum = 1
  129.   --end if
  130.   --set stepNum = stepNum + 1
  131.   set num = the scriptNum of sprite gHelpB
  132.   if num then 
  133.     if not (the name of cast num contains "doAction") then 
  134.       set the timeOutLapsed = 0
  135.     end if
  136.   else 
  137.     set the timeOutLapsed = 0
  138.   end if
  139. end
  140.  
  141.  
  142.  
  143. on checkGUICursors me
  144.   set newlst = []
  145.   set oldlst = []
  146.   set cycleList = [gPrinterB,gBannerartB,gLeftB,gSpeakerB,gHomeB,gHelpB,gRightB]
  147.   
  148.   repeat with i in cycleList
  149.     set num = the scriptNum of sprite i
  150.     if not num then 
  151.       if i = gHomeB then set the timeOutLapsed = 0
  152.       add (oldlst, i)
  153.     else  add (newlst, i)
  154.   end repeat
  155.   
  156.   clearHandCursor (oldlst)
  157.   initHandCursor ("pointer", newlst)
  158. end
  159.  
  160.  
  161. on timeOut me
  162.   timeOut (ancestor)
  163.   set num = the scriptNum of sprite gHomeB
  164.   set num2 = the scriptNum of sprite gHelpB
  165.   if not num or not num2 then 
  166.     set the timeoutLapsed = 0
  167.   else if the timeoutLapsed >= (60 * 60) and the name of cast num contains "doAction" then 
  168.     goMain (me)
  169.   else
  170.     if the name of cast num2 contains "doAction" then mouseDown (me, gHelpB)
  171.   end if
  172. end
  173.  
  174.  
  175.  
  176. on printActivitySpace me, theRect, noTextFlag, noFooterFlag
  177.   if not noTextFlag then
  178.     printCertificate (ancestor)
  179.   else if voidP (noTextFlag) and (the machineType = 256) and not (getLevel (me) mod 2) then
  180.     printActivitySpace (ancestor, theRect, noTextFlag, TRUE)
  181.   else
  182.     printActivitySpace (ancestor, theRect, noTextFlag, FALSE)
  183.   end if
  184. end